Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock facter version based on puppet version & unit tests: print puppet/facter version #1355

Merged
merged 2 commits into from
Nov 1, 2019

Conversation

bastelfreak
Copy link
Member

Getting the correct facter version is tricky. We use facterdb as a source to mock facts see https://github.com/camptocamp/facterdb. People might provide a specific facter version. In that case we use it. Otherwise we need to match the correct facter version to the used puppet version. As of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14 (see https://puppet.com/docs/puppet/5.5/about_agent.html).

@@ -42,6 +42,18 @@
end

RSpec.configure do |c|
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to submit this to modulesync as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. I just need to test it here.

bastelfreak added a commit to bastelfreak/modulesync_config that referenced this pull request Nov 1, 2019
Getting the correct facter version is tricky. We use facterdb as a source to
mock facts see https://github.com/camptocamp/facterdb. People might provide a
specific facter version. In that case we use it. Otherwise we need to match the
correct facter version to the used puppet version. As of 2019-10-31, puppet 5
ships facter 3.11 and puppet 6 ships facter 3.14
(see https://puppet.com/docs/puppet/5.5/about_agent.html).

This was tested at voxpupuli/puppet-nginx#1355
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
ENV['FACTERDB_FACTS_VERSION']
else
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, 3.11 and 3.14 (without the .0) would work now. But that's not important.

@bastelfreak bastelfreak merged commit 1fca6e4 into voxpupuli:master Nov 1, 2019
@bastelfreak bastelfreak deleted the facter branch November 1, 2019 11:36
zachfi pushed a commit to zachfi/modulesync_config that referenced this pull request Feb 5, 2020
Getting the correct facter version is tricky. We use facterdb as a source to
mock facts see https://github.com/camptocamp/facterdb. People might provide a
specific facter version. In that case we use it. Otherwise we need to match the
correct facter version to the used puppet version. As of 2019-10-31, puppet 5
ships facter 3.11 and puppet 6 ships facter 3.14
(see https://puppet.com/docs/puppet/5.5/about_agent.html).

This was tested at voxpupuli/puppet-nginx#1355
Rubueno pushed a commit to Rubueno/puppet-nginx that referenced this pull request Oct 19, 2020
Mock facter version based on puppet version & unit tests: print puppet/facter version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants